package com.niiwoo.civet.user.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Optional;
import java.util.stream.Stream;

/**
 * 短信模板Key枚举类
 *
 * @author daizhiyue
 * @date 2017-12-25
 */
@Getter
@AllArgsConstructor
public enum SMSTemplateKeyEnum {
    /**
     * 短信模板Key枚举
     */
    TEMP_WITHDRAW_FAIL("sms.withdraw.fail", "提现失败"),
    TEMP_WITHDRAW_AUDIT_FAIL("sms.withdraw.audit.fail", "提现审核失败"),
    TEMP_CHANGE_BANK_CARD_AUDIT_PASSED("sms.change.bank.card.audit.passed", "换绑卡审核通过"),
    TEMP_CHANGE_BANK_CARD_AUDIT_PASSED_PAYMENT("sms.change.bank.card.audit.passed.payment", "换绑卡审核通过支付协议"),
    TEMP_CHANGE_BANK_CARD_AUDIT_NOT_PASSED("sms.change.bank.card.audit.not.passed", "换绑卡审核不通过"),
    TEMP_SPEED_LOAN_ENTER_INVEST("sms.speed.loan.enter.invest", "借款进入投资阶段"),
    TEMP_BORROW_SUCCESS("sms.borrow.success", "借款成功"),
    TEMP_BORROW_SUCCESS_AUTO_WITHDRAW("sms.borrow.success.auto.withdraw", "借款成功"),
    TEMP_BORROW_SUCCESS_AUTO_WITHDRAW_FAIL("sms.borrow.success.auto.withdraw.fail", "借款成功自动提现失败"),
    TEMP_BORROW_SUCCESS_EVIDENCE_UPLOAD("sms.borrow.success.evidence.upload","借款成功凭证上传"),
    TEMP_REPAYMENT_OVERUDUE("sms.repayment.overdue", "还款逾期"),
    TEMP_KAOLALICAI_REPAYMENT_FAIL("sms.kaolalicai.repayment.fail", "考拉理财还款失败短信通知"),
    TEMP_KAOLALICAI_BAD_DEBT_SECOND_REPAYMENT_FAIL("sms.kaolalicai.bad.debt.second.repayment.fail", "考拉理财还款-严重逾期第二次还款失败短信通知"),
    TEMP_OPERATOR_AUTH_FAIL("sms.speedloan.operator.auth.fail", "通话记录授权失败短信通知"),
    TEMP_INVEST_RECEIVE_SUCCESS("sms.invest.receive", "投资回款通知"),
    TEMP_SPEEDLOAN_MANUAL_BACK("sms.speedloan.manual.back", "借款审核退回"),
    PROJECT_FLOW_MISCARRY_INVEST_OVERTIME("sms.project.flow.miscarryInvestOvertime", "借款通过审核后，超过7天投资期限未满标流标"),
    PROJECT_FLOW_MISCARRY_INVEST_OVERTIME_2("sms.project.flow.miscarryInvestOvertime2", "超过期限，投资未满，项目流标，金额退回给投资人"),
    PROJECT_FLOW_MISCARRY_CANCER_MANAGER_2("sms.project.flow.miscarryCancerManager2", "项目进入投资阶段，或投资完成，后台审核人员手动或批量流标，金额退回给投资人"),
    PROJECT_FLOW_MISCARRY_BACK_OVERTIME("sms.project.flow.miscarryBackOvertime", "标的退回，超过7天后未重新提交则流标"),
    PROJECT_FLOW_MISCARRY_AUTO_FAILED("sms.project.flow.miscarryAutoFailed", "极速借被自动审核模型拒绝，导致流标"),
    BORROW_REPAYMENT_REMIND("sms.borrow.repayment.remind", "还款提醒"),
    BORROW_REPAYMENT_OVERDUE("sms.borrow.repayment.overdue", "还款逾期"),
    BORROW_REPAYMENT_SERIOUS_OVERDUE("sms.borrow.repayment.serious.overdue", "还款严重逾期"),
    BORROW_CARD_WITHHOLD_FAIL("sms.borrow.card.withhold.fail", "还款提醒-银行代扣失败"),
    BORROW_ACCOUNT_DEBIT_FAIL("sms.borrow.account.debit.fail", "还款提醒-划扣账户失败"),
    ACCOUNT_BALANCE_WARNING("sms.account.balance.warning","账户余额预警"),

    SMS_OPERATOR_OBTAIN_FAIL_RETURN_PROJECT("sms.operator.obtain.fail.return.project", "运营商爬取数据失败退回标的"),
    SMS_SOCIAL_SECURITY_OBTAIN_FAIL_RETURN_PROJECT("sms.social.security.obtain.fail.return.project", "社保爬取数据失败退回标的"),
    SMS_CREDIT_CARD_OBTAIN_FAIL_RETURN_PROJECT("sms.credit.card.obtain.fail.return.project", "信用卡爬取数据失败退回标的"),
    SMS_TAOBAO_OBTAIN_FAIL_RETURN_PROJECT("sms.taobao.obtain.fail.return.project", "淘宝爬取数据失败退回标的"),
    SMS_OTHER_EXCEPTION_RETURN_PROJECT("sms.other.exception.return.project", "其他异常退回标的"),


    SMS_USER_CONFIRM_PUSH_PROJECT("sms.user.confirm.push.project","用户确认上标"),

    /**
     * 卡牛短信模板Key枚举
     */
    CARD_NIU_TEMP_BORROW_SUCCESS("cardniu.sms.borrow.success", "借款成功"),
    CARD_NIU_TEMP_SPEEDLOAN_MANUAL_BACK("cardniu.sms.speedloan.manual.back", "借款审核退回"),
    CARD_NIU_PROJECT_FLOW_MISCARRY_INVEST_OVERTIME("cardniu.sms.project.flow.miscarryInvestOvertime", "借款通过审核后，超过7天投资期限未满标流标"),
    CARD_NIU_BORROW_REPAYMENT_OVERDUE("cardniu.sms.borrow.repayment.overdue", "还款逾期"),
    CARD_NIU_BORROW_REPAYMENT_SERIOUS_OVERDUE("cardniu.sms.borrow. payment.serious.overdue", "还款严重逾期"),
    CARD_NIU_BORROW_CARD_WITHHOLD_FAIL("cardniu.sms.borrow.card.withhold.fail", "还款提醒-银行代扣失败"),
    CARD_NIU_BORROW_ACCOUNT_DEBIT_FAIL("cardniu.sms.borrow.account.debit.fail", "还款提醒-划扣账户失败"),

    CARD_NIU_PROJECT_FLOW_MISCARRY_MANUAL_FAILED("cardniu.sms.project.flow.miscarryManualFailed", "借款标审核不通过"),
    CARD_NIU_PROJECT_FLOW_MISCARRY_CANCER_MANAGER("cardniu.sms.project.flow.miscarryCancerManager", "借款通过审核进入投资阶段，审核人员手动流标"),
    CARD_NIU_INVEST_FINISHED_AND_WITHDRAW_FAIL("cardniu.sms.invest.finished.withdraw.fail", "借款投资满标，但提现失败"),
    CARD_NIU_REPAYMENT_LAST_PHASE("cardniu.sms.repayment.last.phase", "还款成功（项目完结）"),
    CARD_NIU_REPAYMENT_AHEAD("cardniu.sms.repayment.ahead", "信用卡贷提前还款成功，通知借款人"),

    /**
     * 土巴兔短信模板Key枚举
     */
    TO8TO_BORROW_SUCCESS("to8tu.sms.borrow.success", "借款成功"),
    TO8TO_BORROW_SUCCESS_AUTO_WITHDRAW_FAIL("to8tu.sms.borrow.success.auto.withdraw.fail", "借款成功，自动提现失败"),

    ACTIVITY_INVITE_REG_SUCCESS_SMS("invite.reg.success.sms", "邀请好友-被邀请人注册成功"),
    ACTIVITY_INVITE_LOANACCOUNT_SUCCESS_SMS("invite.loanaccount.success.sms", "邀请好友-被邀请人成功开通借款存款账户"),
    ACTIVITY_INVITE_FIRST_LOAN_SUCCESS_SMS("invite.first.loan.success.sms", "邀请好友-被邀请人首次借款成功"),
    ACTIVITY_INVITE_FIRSTRECHARGE_LOAN_SUCCESS_SMS("invite.first.recharge.loan.success.sms", "邀请好友-被邀请人首次成功充值借款存管账户"),
    ACTIVITY_INVITE_INVESTACCOUNT_SUCCESS_SMS("invite.investaccount.success.sms", "邀请好友-被邀请人成功开通投资存款账户"),
    ACTIVITY_INVITE_FIRSTRECHARGE_INVEST_SUCCESS_SMS("invite.first.recharge.invest.success.sms", "邀请好友-被邀请人首次成功充值投资存管账户"),
    ACTIVITY_INVITE_INVEST_SUCCESS_SMS("invite.invest.success.sms", "邀请好友-被邀请人投资成功"),

    //机构代理人注册密码短信提醒
    ORG_AGENT_REGISTER_SUCCESS_SMS("organization.agent.register.sms","机构代理人注册密码短信提醒"),
    FLT_AGENT_REGISTER_SUCCESS_SMS("flt.channel.agent.register.sms","返利投注册密码短信提醒"),
    
    DEBT_TRANSFEROR_TRANSFER_SUCCESS("sms.debt.transferor.transfer.success", "债权转让成功通知"),
    DEBT_TRANSFEROR_TRANSFER_FAIL_REPAYMENT("sms.debt.transferor.transfer.fail.repayment", "债权转让失败通知-还款"),
    INTELLIGENCE_INVEST_SUCCESS("intelligence.invest.success","智能投服务成功通知"),
    INTELLIGENCE_INVEST_PARTIAL_SUCCESS("intelligence.invest.partial.success","智能投服务成功通知"),
    INTELLIGENCE_INVEST_FAILURE("intelligence.invest.failure","智能投服务失败通知"),
    
    // 5.6.0 个性化通知
    PERSONALIZED_NOTIFY_REGISTER_SUCCESS("sms.personalized.register.success", "注册成功"),
    PERSONALIZED_NOTIFY_UNOPEN_INVEST_ACCOUNT("sms.personalized.unopen.invest.account", "未开通投资存管帐户"),
	PERSONALIZED_NOTIFY_OPEN_INVEST_ACCOUNT_SUCCESS("sms.personalized.open.invest.account.success", "已开通投资存管帐户"),
    PERSONALIZED_NOTIFY_NO_INVESTMENT("sms.personalized.no.invest", "开通投资存管帐户未投资"),
    ;



    private String key;
    private String desc;

    public static Optional<SMSTemplateKeyEnum> of(String value) {
        return Stream.of(SMSTemplateKeyEnum.values()).filter(t -> t.getKey().equals(value)).findFirst();
    }


}
